package com.macro.mall.model_jpa;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@Data
@Entity
@Table(name="oms_cart_item")
@DynamicInsert
@DynamicUpdate
public class OmsCartItem implements Serializable {

    private static final long serialVersionUID = 1L;

    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Id
    @Column(name = "id")
    private Long id;

    @Column(name = "product_id")
    private Long productId;

    @Column(name = "product_sku_id")
    private Long productSkuId;

    @Column(name = "member_id")
    private Long memberId;

    @ApiModelProperty(value = "购买数量")
    @Column(name = "quantity")
    private Integer quantity;

    @ApiModelProperty(value = "添加到购物车的价格")
    @Column(name = "price")
    private BigDecimal price;

    @ApiModelProperty(value = "商品主图")
    @Column(name = "product_pic")
    private String productPic;

    @ApiModelProperty(value = "商品名称")
    @Column(name = "product_name")
    private String productName;

    @ApiModelProperty(value = "商品副标题（卖点）")
    @Column(name = "product_sub_title")
    private String productSubTitle;

    @ApiModelProperty(value = "商品sku条码")
    @Column(name = "product_sku_code")
    private String productSkuCode;

    @ApiModelProperty(value = "会员昵称")
    @Column(name = "member_nickname")
    private String memberNickname;

    @ApiModelProperty(value = "创建时间")
    @Column(name = "create_date")
    @CreatedDate
    private Date createDate;

    @ApiModelProperty(value = "修改时间")
    @Column(name = "modify_date")
    @LastModifiedDate
    private Date modifyDate;

    @ApiModelProperty(value = "是否删除")
    @Column(name = "delete_status")
    private Integer deleteStatus;

    @ApiModelProperty(value = "商品分类")
    @Column(name = "product_category_id")
    private Long productCategoryId;

    @Column(name = "product_brand")
    private String productBrand;

    @Column(name = "product_sn")
    private String productSn;

    @ApiModelProperty(value = "商品销售属性:[{'key':'颜色','value':'颜色'},{'key':'容量','value':'4G'}]")
    @Column(name = "product_attr")
    private String productAttr;
}